import Vue from 'vue'
import App from '@/App.vue'

import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
import router from '@/router'
import store from '@/store'

import {
  iconfontUrl,
  iconfontVersion
} from '@/config/env'
import { loadStyle } from '@/utils/util'

import '@/router/permission' // permission control
import * as filters from '@/filters' // 全局filter
import './styles/common.scss'
import 'default-passive-events'

// 动态加载阿里云字体库
iconfontVersion.forEach(ele => {
  loadStyle(iconfontUrl.replace('$key', ele))
})

// 加载过滤器
Object.keys(filters).forEach(key => {
  Vue.filter(key, filters[key])
})

Vue.use(ElementUI, {
  size: 'normal',
  menuType: 'text'
})

Vue.config.productionTip = false

new Vue({
  router,
  store,
  render: h => h(App)
}).$mount('#app')
